package com.skt.domain.DTO.request;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.time.LocalDate;

/**
 * 商家创建服装请求对象
 *
 * 说明：
 * - 用于 POST /merchant/costumes 接口
 * - merchantId 由后端从登录态自动注入，前端不可传
 */
@Data
@Accessors(chain = true)
@Schema(description = "商家创建服装请求")
public class MerchantCostumeCreateRequest {

    @NotBlank(message = "服装名称不能为空")
    @Length(min = 1, max = 100, message = "服装名称长度必须在1-100之间")
    @Schema(description = "服装名称", requiredMode = Schema.RequiredMode.REQUIRED)
    private String name;

    @NotNull(message = "分类ID不能为空")
    @Schema(description = "分类ID（从分类列表接口获取）", requiredMode = Schema.RequiredMode.REQUIRED)
    private Long categoryId;

    @NotBlank(message = "尺码不能为空")
    @Length(max = 20, message = "尺码长度不能超过20")
    @Schema(description = "尺码：S/M/L/XL/定制等", requiredMode = Schema.RequiredMode.REQUIRED)
    private String size;

    @NotNull(message = "库存数量不能为空")
    @Min(value = 0, message = "库存数量不能为负数")
    @Max(value = 9999, message = "库存数量不能超过9999")
    @Schema(description = "库存数量（可租赁件数）", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer stock;

    @Length(max = 30, message = "颜色长度不能超过30")
    @Schema(description = "颜色")
    private String color;

    @Length(max = 50, message = "品牌长度不能超过50")
    @Schema(description = "品牌/来源")
    private String brand;

    @Schema(description = "购入日期")
    private LocalDate purchaseDate;

    @DecimalMin(value = "0.00", inclusive = true, message = "购入价格不能为负数")
    @Digits(integer = 10, fraction = 2, message = "购入价格格式不正确")
    @Schema(description = "购入价格（元）")
    private BigDecimal price;

    @NotNull(message = "日租金不能为空")
    @DecimalMin(value = "0.01", message = "日租金必须大于0")
    @Digits(integer = 10, fraction = 2, message = "日租金格式不正确")
    @Schema(description = "日租金（元）", requiredMode = Schema.RequiredMode.REQUIRED)
    private BigDecimal rentalPrice;

    @Length(max = 1000, message = "描述长度不能超过1000")
    @Schema(description = "描述（材质、特点等）")
    private String description;

    @NotNull
    @Length(max = 255, message = "图片URL长度不能超过255")
    @Schema(description = "图片URL")
    private String imageUrl;
}